﻿/*----------------------------------------------------------------
    Copyright (C) 2016 Senparc
    
    文件名：BaseController.cs
    文件功能描述：Controller基类
    
    
    创建标识：Senparc - 20150312
----------------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Configuration;
using System.Web.Mvc;
using Senparc.Weixin;
using Senparc.Weixin.Exceptions;
using Senparc.Weixin.MP.AdvancedAPIs;
using Senparc.Weixin.MP.AdvancedAPIs.OAuth;

namespace ZLWeChatCard.Controllers
{
    public class BaseController : Controller
    {
        public string validatecode
        {
            get
            {
                if (Session["validatecode"] != null)
                {
                    return (string)Session["validatecode"];
                }
                return null;
            }
            set { Session["validatecode"] = value; }
        }

        
        public string OpenID
        {
            //yzytest201606 
            //omKGCt47hFZqzEQ-S0Fr0hI37G0Uf7
            get { return "omKGCt47hFZqzEQ-S0Fr0hI37G0Uf7"; }
        }

        public  OAuthAccessTokenResult OAuthInfo
        {
            get
            {
                if (Session["OAuthAccessTokenResult"] != null)
                {
                    return (OAuthAccessTokenResult)Session["OAuthAccessTokenResult"];
                }
                return null;
            }
            set { Session["OAuthAccessTokenResult"] = value; }
        }

        public static readonly string Token = WebConfigurationManager.AppSettings["WeixinToken"];//与微信公众账号后台的Token设置保持一致，区分大小写。
        public static readonly string EncodingAESKey = WebConfigurationManager.AppSettings["WeixinEncodingAESKey"];//与微信公众账号后台的EncodingAESKey设置保持一致，区分大小写。
        public static readonly string appId = WebConfigurationManager.AppSettings["WeixinAppId"];//与微信公众账号后台的AppId设置保持一致，区分大小写。
        public static readonly string secret = WebConfigurationManager.AppSettings["WeixinAppSecret"];//与微信公众账号后台的AppId设置保持一致，区分大小写。

        
    }
}
